{% load i18n humanize helpers %}

<table class="table">
    <thead>
        <th>{% trans 'Session Start' %}</th>
        <th>{% trans 'Identity' %}</th>
        <th>{% trans 'Network' %}</th>
        <th class="rf">{% trans 'Duration' %}</th>
        <th class="rf">{% trans 'Hits' %}</th>
    </thead>
    <tbody>
        {% for session in object_list %}
        <tr>
            <td>
                <a href="{% contextual_url 'dashboard:service_session' object.pk session.pk %}"
                    class="font-medium text-urge-700">
                    {{ session.start_time|date:"DATETIME_FORMAT"|capfirst }}
                    {% if session.is_currently_active %}
                    <span class="badge ~positive">Online</span>
                    {% endif %}
                </a>
            </td>
            <td>
                {% if session.identifier %}
                <span class="chip ~neutral">{{session.identifier}}</span>
                {% else %}
                <span class="text-gray-600">&mdash;</span>
                {% endif %}
            </td>
            <td><span class="{{session.country|flag_class}}"></span>{{session.asn|default:"Unknown"}}</td>
            <td class="rf">{{session.duration|naturaldelta}}</td>
            <td class="rf">{{session.hit_set.count|intcomma}}</td>
        </tr>
        {% empty %}
        <tr>
            <td><span class="text-gray-600">{% trans 'No data yet' %}...</span></td>
        </tr>
        {% endfor %}
    </tbody>
</table>